package array;

public class leetCode11_maxArea {

    public int maxArea(int[] height) {
       if(height == null || height.length == 0) return 0;
       int i = 0;
       int j = height.length - 1;
       int max = -1;
       while (i < j){
           if(height[i] < height[j]){
               int result =height[i] * (j - i);
               max = Math.max(max,result);
               i++;
           }else{
               int result =height[j] * (j - i);
               max = Math.max(max,result);
               j--;
           }

       }
       return max;


    }

}
